package net.mingsoft.config;

import org.springframework.boot.context.properties.*;
import org.springframework.core.io.*;

@ConfigurationProperties(prefix = "ms.upload.multipart", ignoreUnknownFields = false)
public class MultipartProperties
{
    private long maxFileSize;
    private long maxRequestSize;
    private boolean resolveLazily;
    private String defaultEncoding;
    private Resource uploadTempDir;
    private int maxInMemorySize;
    
    public MultipartProperties() {
        this.maxFileSize = 1024L;
        this.maxRequestSize = 10240L;
        this.resolveLazily = false;
        this.defaultEncoding = "ISO-8859-1";
        this.uploadTempDir = null;
        this.maxInMemorySize = 4096;
    }
    
    public long getMaxFileSize() {
        return this.maxFileSize * 1000L;
    }
    
    public void setMaxFileSize(final long maxFileSize) {
        this.maxFileSize = maxFileSize;
    }
    
    public long getMaxRequestSize() {
        if (this.maxRequestSize > 0L) {
            return this.maxRequestSize * 1000L;
        }
        return this.maxRequestSize;
    }
    
    public void setMaxRequestSize(final long maxRequestSize) {
        this.maxRequestSize = maxRequestSize;
    }
    
    public boolean isResolveLazily() {
        return this.resolveLazily;
    }
    
    public void setResolveLazily(final boolean resolveLazily) {
        this.resolveLazily = resolveLazily;
    }
    
    public String getDefaultEncoding() {
        return this.defaultEncoding;
    }
    
    public void setDefaultEncoding(final String defaultEncoding) {
        this.defaultEncoding = defaultEncoding;
    }
    
    public Resource getUploadTempDir() {
        return this.uploadTempDir;
    }
    
    public void setUploadTempDir(final Resource uploadTempDir) {
        this.uploadTempDir = uploadTempDir;
    }
    
    public int getMaxInMemorySize() {
        return this.maxInMemorySize;
    }
    
    public void setMaxInMemorySize(final int maxInMemorySize) {
        this.maxInMemorySize = maxInMemorySize;
    }
}
